package oop2;

import java.util.Scanner;

public class JavaClassTest {

	public static void main(String[] args) {
		// 班级类的使用和管理
		Scanner in = new Scanner(System.in);
		System.out.println("新班开班，输入班级信息");
		JavaClass jc = new JavaClass();
		System.out.println("新班名称：");
		jc.clsName = in.next();
		System.out.println("新班的指导老师：");
		jc.teacher = in.next();
		System.out.println("开班时间：");
		jc.startDate = in.next();
		int choice = -1;
		while (true) {
			System.out.println("1:查看班级信息，2：加新生，3：查找学生,9:退出");
			choice = in.nextInt();
			if (choice == 1) {
				jc.showClassInformation();
			} else if (choice == 2) {
				System.out.println("输入新生的姓名：");
				jc.add(in.next());
			} else if (choice == 3) {
				System.out.println("请输入要查找的新生的姓名：");
				String sname = in.next();
				boolean exists = jc.search(sname);
				System.out.println(exists ? (sname + "在" + jc.clsName) : (sname + "不在" + jc.clsName));
			} else if (choice == 9) {
				System.out.println("退出");
				break;
			}
		}
	}

}
